diffpress5 2.2.1
Loading...
Searching...
No Matches
Diff Press 5 Click Driver

API for configuring and manipulating Diff Press 5 Click driver. More...

Topics

 Diff Press 5 Settings
 Settings of Diff Press 5 Click driver.
 Diff Press 5 MikroBUS Map
 MikroBUS pin mapping of Diff Press 5 Click driver.

Functions

void diffpress5_cfg_setup (diffpress5_cfg_t *cfg)
 Diff Press 5 configuration object setup function.
void diffpress5_drv_interface_sel (diffpress5_cfg_t *cfg, diffpress5_drv_t drv_sel)
 Diff Press 5 driver interface setup function.
err_t diffpress5_init (diffpress5_t *ctx, diffpress5_cfg_t *cfg)
 Diff Press 5 initialization function.
err_t diffpress5_read_adc_raw (diffpress5_t *ctx, uint16_t *raw_adc)
 Diff Press 5 read raw ADC value function.
err_t diffpress5_read_adc_voltage (diffpress5_t *ctx, float *voltage)
 Diff Press 5 read voltage level function.
err_t diffpress5_set_vref (diffpress5_t *ctx, float vref)
 Diff Press 5 set vref function.
err_t diffpress5_read_vout (diffpress5_t *ctx, float *vout)
 Diff Press 5 read vout function.
err_t diffpress5_read_vout_avg (diffpress5_t *ctx, uint16_t num_conv, float *vout_avg)
 Diff Press 5 read vout avg function.
err_t diffpress5_calib_offset (diffpress5_t *ctx)
 Diff Press 5 calib offset function.
err_t diffpress5_read_pressure (diffpress5_t *ctx, uint16_t *pressure)
 Diff Press 5 read pressure function.

Detailed Description

API for configuring and manipulating Diff Press 5 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ diffpress5_calib_offset()

err_t diffpress5_calib_offset ( diffpress5_t * ctx)

Diff Press 5 calib offset function.

This function calibrates the zero current offset value.

Parameters
[in]ctx: Click context object. See diffpress5_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function should only be called when no pressure is applied to the sensor.

◆ diffpress5_cfg_setup()

void diffpress5_cfg_setup ( diffpress5_cfg_t * cfg)

Diff Press 5 configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See diffpress5_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ diffpress5_drv_interface_sel()

void diffpress5_drv_interface_sel ( diffpress5_cfg_t * cfg,
diffpress5_drv_t drv_sel )

Diff Press 5 driver interface setup function.

This function sets a serial driver interface which will be used further in the Click driver.

Parameters
[out]cfg: Click configuration structure. See diffpress5_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See diffpress5_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be called before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ diffpress5_init()

err_t diffpress5_init ( diffpress5_t * ctx,
diffpress5_cfg_t * cfg )

Diff Press 5 initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See diffpress5_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See diffpress5_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ diffpress5_read_adc_raw()

err_t diffpress5_read_adc_raw ( diffpress5_t * ctx,
uint16_t * raw_adc )

Diff Press 5 read raw ADC value function.

This function reads raw ADC value.

Parameters
[in]ctx: Click context object. See diffpress5_t object definition for detailed explanation.
[out]raw_adc: Output ADC result.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ diffpress5_read_adc_voltage()

err_t diffpress5_read_adc_voltage ( diffpress5_t * ctx,
float * voltage )

Diff Press 5 read voltage level function.

This function reads raw ADC value and converts it to proportional voltage level.

Parameters
[in]ctx: Click context object. See diffpress5_t object definition for detailed explanation.
[out]voltage: Output voltage level [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered reference voltage.

◆ diffpress5_read_pressure()

err_t diffpress5_read_pressure ( diffpress5_t * ctx,
uint16_t * pressure )

Diff Press 5 read pressure function.

This function reads the differential pressure measurement.

Parameters
[in]ctx: Click context object. See diffpress5_t object definition for detailed explanation.
[out]pressure: Differential pressure level [Pa].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function relies on calibrated zero pressure offset, see diffpress5_calib_offset function.

◆ diffpress5_read_vout()

err_t diffpress5_read_vout ( diffpress5_t * ctx,
float * vout )

Diff Press 5 read vout function.

This function reads the sensor output voltage.

Parameters
[in]ctx: Click context object. See diffpress5_t object definition for detailed explanation.
[out]vout: Output voltage level [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ diffpress5_read_vout_avg()

err_t diffpress5_read_vout_avg ( diffpress5_t * ctx,
uint16_t num_conv,
float * vout_avg )

Diff Press 5 read vout avg function.

This function reads a desired number of sensor voltage output samples and averages it.

Parameters
[in]ctx: Click context object. See diffpress5_t object definition for detailed explanation.
[in]num_conv: Number of ADC samples.
[out]vout_avg: Average output voltage level [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ diffpress5_set_vref()

err_t diffpress5_set_vref ( diffpress5_t * ctx,
float vref )

Diff Press 5 set vref function.

This function sets the voltage reference for Diff Press 5 Click driver.

Parameters
[in]ctx: Click context object. See diffpress5_t object definition for detailed explanation.
[in]vref: Reference voltage (volts).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The default voltage reference set with diffpress5_init is 3.3V.